/**
 * 
 */
package com.Adapters;


import java.util.List;
import java.util.Map;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import com.TextFormat.UtilFonts;
import com.shareup.R;


/**
 * @author Chris
 * 
 */
public class SpinnerAdapter extends SimpleAdapter {

    private Context context;

    /**
     * @param context
     * @param data
     * @param resource
     * @param from
     * @param to
     */
    public SpinnerAdapter(Context context,
                List<? extends Map<String, ?>> data, int resource,
                String[] from, int[] to) {

        super(context, data, resource, from, to);
        // TODO Auto-generated constructor stub
        this.context = context;
    }

    @Override
    public View getDropDownView(int position, View convertView, ViewGroup parent) {

        if (convertView == null) {

            convertView = LayoutInflater.from(context).inflate(R.layout.item_dropdown_spinner, null);
        }
        TextView tx = (TextView) convertView.findViewById(android.R.id.text1);
        UtilFonts.setTextRegularFont(tx);
        return super.getDropDownView(position, convertView, parent);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        if (convertView == null) {

            convertView = LayoutInflater.from(context).inflate(R.layout.item_dropdown_spinner, null);
        }
        TextView tx = (TextView) convertView.findViewById(android.R.id.text1);
        UtilFonts.setTextRegularFont(tx);
        return super.getDropDownView(position, convertView, parent);
    }

}
